<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>媒体查询</title>
    <style>
        div{
            width:100%;
            height:100px;
            background:#009900;
        }




        /*当浏览器窗口小于=960时*/
        @media (max-width:960px){
            div{
                background: red;
            }
        }
        /*当浏览器窗口小于=640时*/
        @media (max-width:640px){
            div{
                background: blue;
            }
        }
        /*当浏览器窗口大于等于960时*/
        @media (min-width:960px){
            div{
                background: #000;
            }
        }
    </style>
</head>
<body>
    <div>这是内容</div>
</body>
</html>